﻿<%@ Page Language="C#" %>

<%@ Import Namespace="AspNetCs.Model" %>
<%@ Import Namespace="AspNetCs.Bll" %>
<%@ Import Namespace="AspNetCs.Common" %>

<script runat="server">
   
    protected decimal result = 0;
    protected int id = 0;
    protected string CalType = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request["id"] != null)
            {
                id = AspNetCs.Common.StringHelper.isNumber_int(Request["id"].ToString());
            }

            if (Request["channeltype"] != null)
            {
                CalType = Request["channeltype"].ToString();
            }



            if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.cemetery.ToString())
            {
                if (Cookie.GetValue("Cemetery_User_" + id) == "CookieNonexistence" || Cookie.GetValue("Cemetery_User_" + id) == "KeyNonexistence")
                {
                    Cookie.SetObj("Cemetery_User_" + id, 60, id.ToString());
                    Cemetery_Bll.CreateNew.filterUpdate(" hot=hot+1 ", "  id=" + id);
                }
            }
            else if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.gravestone.ToString())
            {
                if (Cookie.GetValue("Gravestone_User_" + id) == "CookieNonexistence" || Cookie.GetValue("Gravestone_User_" + id) == "KeyNonexistence")
                {
                    Cookie.SetObj("Gravestone_User_" + id, 60, id.ToString());

                    NetMu_Bll.CreatNew.filterUpdate("hot=hot+1", "id=" + id);
                }
            }
            else if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.memorial.ToString())
            {
                if (Cookie.GetValue("Memorial_User_" + id) == "CookieNonexistence" || Cookie.GetValue("Cemetery_User_" + id) == "KeyNonexistence")
                {
                    Cookie.SetObj("Memorial_User_" + id, 60, id.ToString());

                    Memorial_Bll.CreateNew.filterUpdate("hot=hot+1", "id=" + id);
                }
            }

            else if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.clan.ToString())
            {
                if (Cookie.GetValue("clan_User_" + id) == "CookieNonexistence" || Cookie.GetValue("clan_User_" + id) == "KeyNonexistence")
                {
                    Cookie.SetObj("clan_User_" + id, 60, id.ToString());

                    AncestralHall_Bll.CreatNew.filterUpdate("AcceeCount=AcceeCount+1", "id=" + id);
                }
            }


            if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.cemetery.ToString())
            {
                Cemetery_Model md = Cemetery_Bll.CreateNew.GetModel(id);
                result = md.Hot;
            }
            else if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.gravestone.ToString())
            {
                NetMu_Model Md = NetMu_Bll.CreatNew.getNetMuDetailInfo(id);
                result = (decimal)Md.Hot;
            }
            else if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.memorial.ToString())
            {
                memorial_model md = Memorial_Bll.CreateNew.GetModel(id);
                result = md.Hot;

            }
            else if (CalType == AspNetCs.Enumerations.Channel_Enum.Channel_Type.clan.ToString())
            {
                AncestralHall_Model md = AncestralHall_Bll.CreatNew.GetModel(id);
                result = md.AcceeCount;
            }

        }
        catch
        {
            result = 0;
        }
        Response.Write(result);
    }      
</script>

